﻿using System;
using System.Collections.Generic;
using Bricks.Data;
using NHibernate;

namespace Bricks.NHibernate.Data
{
    
    /// <summary>
    /// 
    /// </summary>
    public interface IQueryOverFacade : ISessionFacade
    {

        /// <summary>
        /// 
        /// </summary>
        /// <typeparam name="TEntity"></typeparam>
        /// <param name="predicate"></param>
        /// <returns></returns>
        int Count<TEntity>(Func<IQueryOver<TEntity, TEntity>, IQueryOver<TEntity>> predicate) where TEntity : class;

        /// <summary>
        /// 
        /// </summary>
        /// <typeparam name="TEntity"></typeparam>
        /// <typeparam name="T"></typeparam>
        /// <param name="predicate"></param>
        /// <returns></returns>
        IEnumerable<T> Query<TEntity, T>(Func<IQueryOver<TEntity, TEntity>, IQueryOver<TEntity>> predicate) where TEntity : class;

        /// <summary>
        /// 
        /// </summary>
        /// <typeparam name="TEntity"></typeparam>
        /// <typeparam name="T"></typeparam>
        /// <param name="predicate"></param>
        /// <param name="pageIndex"></param>
        /// <param name="pageSize"></param>
        /// <returns></returns>
        PagedResult<T> Query<TEntity, T>(Func<IQueryOver<TEntity, TEntity>, IQueryOver<TEntity>> predicate, int pageIndex, int pageSize) where TEntity : class;

        /// <summary>
        /// 
        /// </summary>
        /// <typeparam name="TEntity"></typeparam>
        /// <typeparam name="T"></typeparam>
        /// <param name="predicate"></param>
        /// <returns></returns>
        T QuerySingle<TEntity, T>(Func<IQueryOver<TEntity, TEntity>, IQueryOver<TEntity>> predicate) where TEntity : class;
    }
}
